{include file="common/header"}
<div id="app" v-cloak>
    <el-curd 
        :field="field" 
        :table-sort="{prop: 'create_time', order: 'desc'}"
        :search-status="[{label: '正常', value: 1}, {label: '屏蔽', value: 0}]"
        :delete-authority="false"
        save-title="新增虚拟会员"
        search-keyword="请输入邮箱/手机/昵称/ID搜索"
        preview>
    </el-curd>
</div>
<script>
    new Vue({
        el: '#app',
        data() {
            return {
                field: [
                    {
                        label: '编号', 
                        prop: 'id',
                        table: false,
                    },
                    {
                        prop: 'cover', 
                        label: '会员头像', 
                        table: {
                            label: '',
                            is: 'image',
                            width: '60px', 
                        },
                        form: {
                            is: 'el-file-select',
                            type: 'image', 
                            default: "{$config.cover}"
                        },
                    },
                    {
                        prop: 'email', 
                        label: '会员邮箱号', 
                        table: {
                            label: '资料信息', 
                            bind: ['mobile'], 
                            sort: true
                        },
                        form: {
                            rules: [
                                {required: true, message: '邮箱不能为空'},
                            ],
                        },
                    },
                    {
                        prop: 'mobile', 
                        label: '会员手机号', 
                        table: false,
                    },
                    {
                        prop: 'nickname', 
                        label: '会员昵称', 
                        table: false,
                        form: {
                            rules: [
                                {required: true, message: '昵称不能为空'},
                            ],
                            default: "{$config.nickname}"
                        },
                    },
                    {
                        prop: 'login_count', 
                        label: '登录次数', 
                        table:{sort: true},
                        form: false,
                    },
                    {
                        prop: 'balance', 
                        label: '可用余额',  
                        table:{sort: true},
                        form: {type: 'number',default: 0.00}
                    },
                    {
                        prop: 'password', 
                        label: '登录密码', 
                        table: false, 
                        form: {
                            type: 'password',
                            placeholder: '不修改密码则此处为空',
                            rules: [
                                {saveRequired: true, message: '新增用户时，密码不能为空'},
                                {pattern: /^[^\u4e00-\u9fa5]+$/, message: '不能包含中文字符'}
                            ],
                        },
                    },
                    {
                        prop: 'now_integral', 
                        label: '当前积分',  
                        table:{sort: true},
                        form: {type: 'number',default: 0}
                    },
                    {
                        prop: 'group_id', 
                        label: '当前分组',
                        table: {prop: 'group_title', sort: true},
                        form: {
                            is: 'el-select', 
                            child: {is: 'el-option',value: {:json_encode($group)}, props:{label: 'title', value: 'id'}},
                            rules: [
                                {required: true, message: '请选择组别'},
                            ],
                        },
                    },
                    {
                        prop: 'sex', 
                        label: '会员性别', 
                        table: false,
                        form: {
                            is: 'el-select',
                            default: 0, 
                            child: {is: 'el-option', value:[{label:'男', value:0},{label:'女',value:1}]},
                            colMd: 12
                        }
                    },
                    {
                        prop: 'birthday', 
                        label: '会员生日',
                        table: false,
                        form: {
                            is: 'el-date-picker', 
                            type: 'date', format: 'yyyy-MM-dd', 
                            valueFormat: 'yyyy-MM-dd',
                            colMd: 12
                        },
                    },
                    {
                        prop: 'describe', 
                        label: '简短签名', 
                        table: false,
                        form: {type: 'textarea', default: "{$config.describe}"},
                    },
                    {
                        prop: 'status',
                        label: '当前状态',  
                        table: {is: 'el-switch', sort: true},
                        form: {is: 'el-switch', default: 1},
                    },
                    {
                        prop: 'reason', 
                        label: '屏蔽原因', 
                        table: false,
                        form: {
                            type: 'textarea',
                            relation: [{prop: 'status', value: 0}],
                        },
                    },
                    {
                        prop: 'create_time', 
                        label: '注册时间', 
                        table:{
                            label: '注册&登录时间',
                            sort: true, 
                            bind: ['login_time']
                        },
                        form: false,
                    },
                ],
            }
        },
    })
</script>
{include file="common/footer"}